package com.agu.mgt.common.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.agu.utils.Query;

import java.util.List;
import java.util.Map;

import com.agu.mgt.common.dao.CmmUploadFilesDao;
import com.agu.entity.common.CmmUploadFilesEntity;
import com.agu.mgt.common.service.CmmUploadFilesService;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;


@Service("cmmUploadFilesService")
@Transactional(readOnly = true)
public class CmmUploadFilesService{
	@Autowired
	private CmmUploadFilesDao cmmUploadFilesDao;
	
	
	public CmmUploadFilesEntity queryObject(Long fileId){
		return cmmUploadFilesDao.queryObject(fileId);
	}
	
	
	public List<CmmUploadFilesEntity> queryList(Map<String, Object> map){
		return cmmUploadFilesDao.queryList(map);
	}

    
	public Page<CmmUploadFilesEntity> queryPageList(Query query){
	    PageHelper.startPage(query.getPage(), query.getLimit());
	    return cmmUploadFilesDao.queryPageList(query);
	}
	
	
	public int queryTotal(Map<String, Object> map){
		return cmmUploadFilesDao.queryTotal(map);
	}
	
	
	@Transactional
	public void save(CmmUploadFilesEntity cmmUploadFiles){
		cmmUploadFilesDao.save(cmmUploadFiles);
	}
	
	
	@Transactional
	public void update(CmmUploadFilesEntity cmmUploadFiles){
		cmmUploadFilesDao.update(cmmUploadFiles);
	}
	
	
	@Transactional
	public void delete(Long fileId){
		cmmUploadFilesDao.delete(fileId);
	}
	
	
	@Transactional
	public void deleteBatch(Long[] fileIds){
		cmmUploadFilesDao.deleteBatch(fileIds);
	}
}
